package com.pilot.game.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A Agency.
 */
@Entity
@Table(name = "代理")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Agency implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Column(name = "账号", nullable = false)
    private String accountName;

    @NotNull
    @Column(name = "密码", nullable = false)
    private String password;

    @Column(name = "用户数限制")
    private Integer limit;

    @Column(name = "使用期限")
    private LocalDate deadline;

    @Column(name = "在线")
    private Integer online;

    @Column(name = "心跳时间")
    private ZonedDateTime heard;

    @Column(name = "登录状态")
    private Integer status;

    @Column(name = "agency_limit")
    private Integer agencyLimit;

    @Column(name = "father")
    private String father;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAccountName() {
        return accountName;
    }

    public Agency accountName(String accountName) {
        this.accountName = accountName;
        return this;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getPassword() {
        return password;
    }

    public Agency password(String password) {
        this.password = password;
        return this;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getLimit() {
        return limit;
    }

    public Agency limit(Integer limit) {
        this.limit = limit;
        return this;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }

    public LocalDate getDeadline() {
        return deadline;
    }

    public Agency deadline(LocalDate deadline) {
        this.deadline = deadline;
        return this;
    }

    public void setDeadline(LocalDate deadline) {
        this.deadline = deadline;
    }

    public Integer getOnline() {
        return online;
    }

    public Agency online(Integer online) {
        this.online = online;
        return this;
    }

    public void setOnline(Integer online) {
        this.online = online;
    }

    public ZonedDateTime getHeard() {
        return heard;
    }

    public Agency heard(ZonedDateTime heard) {
        this.heard = heard;
        return this;
    }

    public void setHeard(ZonedDateTime heard) {
        this.heard = heard;
    }

    public Integer getStatus() {
        return status;
    }

    public Agency status(Integer status) {
        this.status = status;
        return this;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getAgencyLimit() {
        return agencyLimit;
    }

    public Agency agencyLimit(Integer agencyLimit) {
        this.agencyLimit = agencyLimit;
        return this;
    }

    public void setAgencyLimit(Integer agencyLimit) {
        this.agencyLimit = agencyLimit;
    }

    public String getFather() {
        return father;
    }

    public Agency father(String father) {
        this.father = father;
        return this;
    }

    public void setFather(String father) {
        this.father = father;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Agency agency = (Agency) o;
        if (agency.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), agency.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "Agency{" +
            "id=" + getId() +
            ", accountName='" + getAccountName() + "'" +
            ", password='" + getPassword() + "'" +
            ", limit='" + getLimit() + "'" +
            ", deadline='" + getDeadline() + "'" +
            ", online='" + getOnline() + "'" +
            ", heard='" + getHeard() + "'" +
            ", status='" + getStatus() + "'" +
            ", agencyLimit='" + getAgencyLimit() + "'" +
            ", father='" + getFather() + "'" +
            "}";
    }
}
